const moment = require('moment');
const date = new Date();
console.log(date); // 2022-04-12T03:29:03.406Z

const time = moment(date);
console.log(time); // Moment<2022-04-12T11:30:19+08:00>

// 获取当前时间戳(毫秒)
const timestamp = Math.floor(date);
console.log(timestamp); // 1649734402631

// 获取当前时间戳(秒)

const timestamp2 = Math.floor(date / 1000);
console.log(timestamp2); // 1649734570